<!--
	作者：offline
	时间：2018-11-28
	描述：送货计划单详情/创建
-->

<template>
  <div class="m-view-deliverComponents m-window">
    <el-row :gutter="5">
      <el-col :span="24" :offset="offset">
        <el-row :gutter="10">
          <el-col :span="2">
            <el-button @click="cancel(true)" :disabled="btnDis">返回</el-button>
          </el-col>
          <el-col :span="2" v-if="btnShow">
            <el-button type="primary" @click="save" :disabled="btnDis">保存</el-button>
          </el-col>
          <el-col :span="2" v-if="btnShow">
            <el-button type="primary" @click="audit" :disabled="btnDis">审核</el-button>
          </el-col>
        </el-row>
      </el-col>
    </el-row>
    <el-row :gutter="5">
      <el-form
        :model="ruleForm"
        ref="ruleForm"
        label-width="70px"
        :inline-message="true"
        label-position="left"
      >
        <el-col :span="5">
          <el-form-item label="计划单号" prop="planNo" class="rightItem">
            <el-input v-model="ruleForm.planNo" placeholder="送货单号" :disabled="inputDis"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="5">
          <el-form-item label="单据日期" class="redItem">
            <el-date-picker
              v-model="ruleForm.planDate"
              type="date"
              placeholder="单据日期"
              value-format="yyyy-MM-dd"
              :disabled="inputDis2"
              :picker-options="pickerOptions"
            ></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="供应商" class="rightItem">
            <el-input v-model="ruleForm.supplierName" placeholder="供应商" :disabled="inputDis"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="公司" class="rightItem">
            <el-select
              value-key="id"
              v-model="ruleForm.companyCode"
              placeholder="请选择公司"
              ref="content"
              :disabled="inputDis"
            >
              <el-option
                v-for="item in comOptions"
                :key="item.id"
                :label="item.companyName"
                :value="item.companyCode"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="5">
          <el-form-item label="采购单号" prop="purOrdNo" class="rightItem">
            <el-input v-model="ruleForm.purOrdNo" placeholder="采购订单号" :disabled="inputDis"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="5">
          <el-form-item label="订单日期">
            <el-date-picker
              v-model="ruleForm.purOrdDate"
              type="date"
              placeholder="订单日期"
              value-format="yyyy-MM-dd"
              :disabled="inputDis"
              :picker-options="pickerOptions"
            ></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="14">
          <el-form-item label="备注" class="rightItem">
            <el-input
              v-model="ruleForm.remark"
              placeholder="备注(100字)"
              :disabled="remarkDis"
              maxlength="100"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
    <div class="m-mainContent m-top150">
      <agGridComponents
        ref="agGirdComponent"
        :getGridOptions="gridOptions"
        :getColumnDefs="columnDefs"
        :isColFit="isColFit"
      ></agGridComponents>
    </div>
  </div>
</template>

<script>
import localeText from "@/i18n/agGridText";
import agGridComponents from "@/components/agGridComponents.js";
import authInfo from "@/public/authInfo.js";
import Vue from "vue";
import _Api from "@/api";
import addOperation from "@/public/addOperation.js";
import NumericEditorComponent from "@/components/NumericEditorComponent.js";
import DatePickerComponent from "@/components/DatePickerComponent.js";
import serverTime from "@/public/serverTime.js";
import constant from "@/public/constant";
import Msg from "@/public/message.js";

const operator = Vue.extend({
  template: `<span>
		<el-button type="text" @click="delDetails" class="rendererClass" size="mini" v-if=" delDetailsShow && params.node.data.id >=0 ? true :false ">删除</el-button>
		</span>`,
  data () {
    return {
      delDetailsShow: operator.delDetailsShow
    };
  },
  methods: {
    delDetails () {
      this.params.context.componentParent.deleteDetails(this.params.node);
    }
  }
});

export default {
  data () {
    return {
      name: 'plan',
      btnDis: false,
      inputDis: false,
      inputDis2: false,
      comOptions: [],
      remarkDis: false,
      isColFit: true,
      gridOptions: "",
      columnDefs: "",
      totalPlanAmount: 0,
      pickerOptions: {
        disabledDate (time) {
          return time.getTime() < Date.now() - 3600 * 1000 * 24;
        }
      },
      ruleForm: {},
      ruleFormBottom: {},
      rowData: [],
      btnShow: true,
      offset: 18
    };
  },
  methods: {
    //获取送货计划单号
    getDeliveryPlanNo () {
      let that = this;
      this.$refs.agGirdComponent.loading = true;
      return new Promise((resolve, reject) => {
        _Api
          .getPlanNo()
          .then(function (response) {
            let data = response.data;
            if (data.code == "1") {
              that.$set(that.ruleForm, "planNo", data.rows);
              resolve(data.rows)
            } else {
              Msg.showErrorMsg(data.info);
              reject(data.info)
            }
            that.$refs.agGirdComponent.loading = false;
          })
          .catch(err => {
            Msg.showErrorMsg(err.data.message);
            reject(err.data.message)
          });
      })
    },
    //审核
    audit () {
      let that = this;
      let params = {};
      this.$refs.agGirdComponent.gridOptions.api.stopEditing();
      if (this.ruleForm.planDate == null || this.ruleForm.planDate == "") {
        Msg.showPopMsg("请选择单据日期");
        return;
      }
      if (!this.validaParamas(this.rowData)) return
      let paramsData = JSON.parse(JSON.stringify(this.rowData))
      // 日期格式化
      paramsData.forEach(row => {
        row.deliveryDate = `${row.deliveryDate} 00:00:00`
        row.sendDate = `${row.sendDate} 00:00:00`
      })
      if (this.pageLayOut == "add") {
        //创建人
        this.ruleForm.creator = constant.userName;
        this.ruleForm.creatorId = constant.userId;
        this.ruleForm.purOrdNo = this.rowData[0].purOrdNo;
        this.ruleForm.supplierCode = this.supplierInfo[0].supplierCode;
      } else {
        // 修改人
        this.ruleForm.modifyer = constant.userName;
        this.ruleForm.modifyerId = constant.userId;
        //保存时不要用ruleForm，应该新创建一个对象 后面优化
        Vue.delete(this.ruleForm, "creator");
        Vue.delete(this.ruleForm, "creatorId");
        Vue.delete(this.ruleForm, "createDate");
      }
      this.ruleForm.planDate = `${this.ruleForm.planDate} 00:00:00`
      this.ruleForm.billState = 2;
      this.ruleForm.auditor = constant.userName;
      this.ruleForm.auditorId = constant.userId;
      params.tblDeliveryplanbill = this.ruleForm;
      params.tblDeliveryplanmxs = paramsData;
      //日期服务端端处理
      Vue.delete(params.tblDeliveryplanbill, "auditDate");
      Vue.delete(params.tblDeliveryplanbill, "modifyDate");
      Vue.delete(params.tblDeliveryplanbill, "createDate");
      that.btnDis = true;
      _Api.saveDelPlan(params).then(function (response) {
        let data = response.data;
        if (data.code == "1") {
          Msg.showSuccessMsg("审核成功！");
          that.cancel(true);
        } else {
          Msg.showErrorMsg(data.info);
        }
        that.btnDis = false;
      })
        .catch(err => {
          Msg.showErrorMsg(err.data.message);
          that.btnDis = false;
        });
    },
    // 返回回调
    cancel (msg) {
      this.$emit("cancelComponents", msg);
    },
    // 点击保存回调
    save () {
      this.$refs.agGirdComponent.gridOptions.api.stopEditing();
      let that = this
      //保存
      setTimeout(() => {
        if (that.pageLayOut == "add") {
          that.addSave();
        } else if (that.pageLayOut == "edit") {
          that.editSave();
        }
      }, 100)
    },
    //新增保存
    addSave () {
      if (this.ruleForm.planDate == null || this.ruleForm.planDate == "") {
        Msg.showPopMsg("请选择单据日期");
        return;
      }
      let params = {};
      let that = this;
      if (!this.validaParamas(this.rowData)) return
      this.ruleForm.planDate = `${this.ruleForm.planDate} 00:00:00`
      let paramsData = JSON.parse(JSON.stringify(this.rowData))
      paramsData.forEach(row => {
        row.deliveryDate = `${row.deliveryDate} 00:00:00`
        row.sendDate = `${row.sendDate} 00:00:00`
      })
      this.ruleForm.creator = constant.userName;
      this.ruleForm.creatorId = constant.userId;
      this.ruleForm.supplierCode = this.supplierInfo[0].supplierCode;
      this.ruleForm.purOrdNo = this.rowData[0].purOrdNo;
      this.ruleForm.billState = 1;
      params.tblDeliveryplanbill = this.ruleForm;
      params.tblDeliveryplanmxs = paramsData;
      //日期服务端端处理
      Vue.delete(params.tblDeliveryplanbill, "auditDate");
      Vue.delete(params.tblDeliveryplanbill, "modifyDate");
      Vue.delete(params.tblDeliveryplanbill, "createDate");
      this.btnDis = true;
      _Api
        .saveDelPlan(params)
        .then(function (response) {
          let data = response.data;
          if (data.code == "1") {
            Msg.showSuccessMsg("保存成功！");
            that.cancel(true);
          } else {
            Msg.showErrorMsg(data.info);
          }
          that.btnDis = false;
        })
        .catch(err => {
          Msg.showErrorMsg(err.data.message);
          that.btnDis = false;
        });

    },
    // 验证参数
    validaParamas (rowData) {
      if (rowData.length < 1) {
        Msg.showPopMsg("明细不能为空!");
        return false;
      } else {
        let reg = /^[0-9]+(.[0-9]{2})?$/; //有两位小数的正实数
        for (let i in rowData) {
          //验证数字输入        
          if (!reg.test(rowData[i].planAmount)) {
            Msg.showPopMsg("行号：" + rowData[i].deliveryIMxNo + " 物料号：" + rowData[i].matCode + " 的计划数量只能输入数字!");
            return false;
          }
          if (rowData[i].planAmount == null || rowData[i].planAmount <= 0) {
            Msg.showPopMsg("行号：" + rowData[i].deliveryIMxNo + " 物料号：" + rowData[i].matCode + " 的计划数量要大于0！");
            return false;
          }
          if (rowData[i].planAmount > rowData[i].planableAmount) {
            Msg.showPopMsg("行号：" + rowData[i].deliveryIMxNo + " 物料号：" + rowData[i].matCode + " 的计划数量不能大于可计划数量！");
            return false;
          }
          if (!rowData[i].sendDate) {
            Msg.showPopMsg("行号：" + rowData[i].deliveryIMxNo + " 物料号：" + rowData[i].matCode + "未选择送货日期！");
            return false
          }
        }
        return true
      }
    },
    // 校验价格单位误差
    checkRange (data) {
      let range = true;
      if (data) {
        const { priceAmount, actualAmount, numerator, denominator } = data
        let newAmount = actualAmount * (numerator / denominator)
        let minAmount = newAmount - newAmount * 0.25
        let maxAmount = newAmount + newAmount * 0.25
        if (Number(priceAmount) > maxAmount || Number(priceAmount) < minAmount) {
          range = false
        }
        return range
      }
    },
    //修改保存
    editSave () {
      let params = {};
      let that = this;
      if (this.ruleForm.planDate == "" || this.ruleForm.planDate == null) {
        Msg.showPopMsg("请选择单据日期");
        return;
      }
      if (!this.validaParamas(this.rowData)) return
      this.ruleForm.planDate = `${this.ruleForm.planDate} 00:00:00`
      let paramsData = JSON.parse(JSON.stringify(this.rowData))
      //对日期格式进行转换 
      paramsData.forEach(row => {
        row.deliveryDate = `${row.deliveryDate} 00:00:00`
        row.sendDate = `${row.sendDate} 00:00:00`
        row.modifyer = constant.userName
        row.modifyerId = constant.userId
      })
      // 传入修改人和修改人Id
      this.ruleForm.modifyer = constant.userName;
      this.ruleForm.modifyerId = constant.userId;
      this.ruleForm.purOrdNo = this.rowData[0].purOrdNo;
      this.ruleForm.billState = 1;
      params.tblDeliveryplanbill = this.ruleForm;
      params.tblDeliveryplanmxs = paramsData;
      //日期服务端端处理
      Vue.delete(params.tblDeliveryplanbill, "auditDate");
      Vue.delete(params.tblDeliveryplanbill, "modifyDate");
      Vue.delete(params.tblDeliveryplanbill, "createDate");
      this.btnDis = true;
      _Api.saveDelPlan(params)
        .then(function (response) {
          let data = response.data;
          if (data.code == "1") {
            Msg.showSuccessMsg("保存成功！");
            that.cancel(true);
          } else {
            Msg.showErrorMsg(data.info);
          }
          that.btnDis = false;
        })
        .catch(err => {
          Msg.showErrorMsg(err.data.message);
          that.btnDis = false;
        });
    },
    //创建底部合计行
    createBottomRow (count, prefix) {
      let result = [
        {
          matName: "合计",
          planAmount: this.totalPlanAmount
        }
      ];
      return result;
    },
    //获取并展示送货计划单详情
    getDelPlanDetail (planId) {
      let params = {
        id: planId
      };
      let that = this;
      this.$refs.agGirdComponent.loading = true;
      _Api.getPlanDetail(params).then(function (response) {
        let data = response.data;
        if (data.code == "1") {
          if (data.total > 0) {
            that.rowData = data.rows.tblDeliveryplanmxs.splice(0);
            that.sameUnit(that.rowData);
            that.$refs.agGirdComponent.gridOptions.api.setRowData(that.rowData);
            that.totalPlanAmount = 0;
            that.$refs.agGirdComponent.gridOptions.api.forEachNode(function (node) {
                // 计算底部合计数量
              that.totalPlanAmount = addOperation.accAdd(
                node.data.planAmount,
                that.totalPlanAmount
              );
              that.$refs.agGirdComponent.gridOptions.api.setPinnedBottomRowData(
                that.createBottomRow(1, "Bottom")
              );
            });
            that.$refs.agGirdComponent.rowDataChange = false;
            if (that.getClickValue.billState == 2 && that.pageLayOut == "edit" || that.pageLayOut == "view") {
              let col = that.$refs.agGirdComponent.gridOptions.columnApi.getAllDisplayedColumns();
              for (let c in col) {
                col[c].colDef.editable = () => {
                  return false;
                };
              }
            }
          } else {
            that.$refs.agGirdComponent.gridOptions.api.setRowData([]);
          }
          that.$refs.agGirdComponent.loading = false;
        } else {
          Msg.showErrorMsg(data.info);
          that.$refs.agGirdComponent.loading = false;
        }
      })
        .catch(err => {
          that.$refs.agGirdComponent.loading = false;
          Msg.showErrorMsg(err.data.message);
          that.btnDis = false;
        });
    },
    //删除明细行
    deleteDetails (params) {
      let that = this;
      if (params.data.id > 0 && params.data.id != null) {
        let sumId = 0;
        this.$refs.agGirdComponent.gridOptions.api.forEachNode(function (node) {
          if (node.data.id > 0) sumId++;
        });
        if (sumId == 1) {
          Msg.showErrorMsg("至少保留1条已保存的数据！");
          return;
        }
        this.$confirm("是否确认删除该数据？", "消息提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          distinguishCancelAndClose: true
        })
          .then(() => {
            if (params.data.id > 0) {
              let obj = {
                id: params.data.id
              };
              _Api
                .deletePlanDetail(obj)
                .then(function (response) {
                  let data = response.data;
                  if (data.code == "1") {
                    Msg.showSuccessMsg("操作成功");
                    that.afterDel(params);
                  } else {
                    Msg.showErrorMsg(data.info);
                  }
                })
                .catch(err => {
                  Msg.showErrorMsg(err.data.message);
                  that.btnDis = false;
                });
            }
          })
          .catch(() => { });
      } else {
        let that = this;
        this.$confirm("是否确认删除该数据？", "消息提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          distinguishCancelAndClose: true
        })
          .then(function (response) {
            that.afterDel(params);
          })
          .catch(() => { });
      }
    },
    //删除明细后重算合计行
    afterDel (params) {
      let arr = [];
      let that = this;
      arr.push(params.data);
      //删除表格行
      this.$refs.agGirdComponent.gridOptions.api.updateRowData({
        remove: arr
      });
      this.rowData.splice(params.rowIndex, 1);
      //重算合计行
      this.totalPlanAmount = 0;
      this.$refs.agGirdComponent.gridOptions.api.forEachNode(function (node) {
        if (node.data.planAmount != null) {
          that.totalPlanAmount = addOperation.accAdd(
            node.data.planAmount,
            that.totalPlanAmount
          );
          that.$refs.agGirdComponent.gridOptions.api.setPinnedBottomRowData(
            that.createBottomRow(1, "Bottom")
          );
        }
      });
    },
    // 单元格获取焦点回调
    cellFocused (params) {
      let that = this;
      if (params.column) {
        this.$refs.agGirdComponent.gridOptions.api.forEachNode(function (node) {
          let col = node.columnApi.getAllDisplayedColumns();
          if (that.pageLayOut == "edit" && that.getClickValue.billState > 2 || that.pageLayOut == "view") {
            for (let c in col)
              col[c].colDef.editable = () => {
                return false;
              };
          } else {
            for (let c in col) {
              if (col[c].colId == "sendDate") {
                // col[c].colDef.editable = function(node) {
                //   if (!node.data.isBarCode) return true;
                //   else return false;
                // };
              }
            }
          }
        });
      }
    },
    // 单元格值change事件
    cellValueChanged (pra) {
      let that = this;
      this.totalPlanAmount = 0;
      this.$refs.agGirdComponent.gridOptions.api.forEachNode(function (node) {
        // let col = node.columnApi.getAllDisplayedColumns();
        if (
          node.data.planAmount == 0 ||
          node.data.planAmount > 0 ||
          node.data.planAmount < 0
        ) {
          that.totalPlanAmount = addOperation.accAdd(
            node.data.planAmount,
            that.totalPlanAmount
          );
          that.$refs.agGirdComponent.gridOptions.api.setPinnedBottomRowData(
            that.createBottomRow(1, "Bottom")
          );
        }
      });
    },
    // 单元格编辑结束事件
    cellEditingStarted (params) {
      if (params.rowPinned) params.api.stopEditing();
    },
    // 判断价格单位与单位是否一致
    sameUnit (rowData) {
      let hideCol = rowData.every(row => {
        // 判断明细中所有价格单位与单位是否一致
        return row.unitCode == row.priceUnit
      })
      if (hideCol) {
        this.$refs.agGirdComponent.gridOptions.columnApi.setColumnVisible(
          "priceUnit",
          false
        );
        this.$refs.agGirdComponent.gridOptions.columnApi.setColumnVisible(
          "priceAmount",
          false
        );
      }
    }
  },
  beforeMount () {
    this.gridOptions = {
      context: {
        componentParent: this
      },
      enableColResize: true,
      localeText: localeText,
      defaultColDef: {
        menuTabs: []
      },
      //          	getContextMenuItems:[],
      singleClickEdit: true,
      onCellFocused: this.cellFocused,
      onCellEditingStarted: this.cellEditingStarted,
      pinnedBottomRowData: this.createBottomRow(1, "Bottom"),
      getRowStyle: function (params) {
        if (params.node.rowPinned) {
          return { color: "red", "font-weight": "bold" };
        }
      }
    };
    this.columnDefs = [
      {
        headerName: "操作",
        field: "operator",
        cellRendererFramework: operator,
        width: 70
      },
      {
        headerName: "行号",
        field: "deliveryIMxNo",
        width: 70
      },
      { headerName: "物料编码", field: "matCode", width: 100 },
      { headerName: "物料描述", field: "matName", width: 160 },
      { headerName: "订单数量", field: "orderAmount", width: 90 },
      { headerName: "单位", field: "unitCode", width: 70 },
      {
        headerName: "价格数量",
        field: "priceAmount",
        width: 90
      },
      {
        headerName: "价格单位",
        field: "priceUnit",
        width: 90
      },
      {
        headerName: "计划数量",
        field: "planAmount",
        editable: true,
        cellEditorFramework: NumericEditorComponent,
        width: 90,
        onCellValueChanged: this.cellValueChanged
      },
      {
        headerName: "送货区域",
        field: "area",
        editable: true,
        width: 90,
        onCellValueChanged: this.cellValueChanged
      },
      {
        headerName: "送货日期",
        field: "sendDate",
        editable: true,
        cellEditorFramework: DatePickerComponent,
        cellRenderer: function (params) {
          if (params.value) {
            return new Date(Date.parse(params.value.replace(/-/g,"/"))).Format("yyyy-MM-dd");
          }
        },
        width: 100
      },
      {
        headerName: "交货日期",
        field: "deliveryDate",
        cellRenderer: function (params) {
          if (params.value)
            return new Date(Date.parse(params.value.replace(/-/g,"/"))).Format("yyyy-MM-dd");
        },
        width: 100
      },
      { headerName: "备注", field: "remark", editable: true, width: 70 },
      { headerName: "工厂", field: "plantName", width: 80 },
      { headerName: "采购订单", field: "purOrdNo", width: 100 },
      { headerName: "采购订单行号", field: "purOrdMxNo", width: 120 }
    ];
  },
  mounted () {
    this.$set(operator, "delDetailsShow", true)
    this.isColFit = true
    let that = this;
    //初始化公司数据源
    authInfo.getAuthInfo().then(authCompanyInfo => {
      that.comOptions = authCompanyInfo;
    });
    // 创建或编辑计划单时数据初始化
    if (this.pageLayOut == "add") {
      this.totalPlanAmount = 0;
      this.btnShow = true;
      this.inputDis = true;
      this.ruleForm.supplierId = this.supplierInfo[0].id;
      this.ruleForm.supplierCode = this.supplierInfo[0].supplierCode;
      this.ruleForm.supplierName = this.supplierInfo[0].supplierName;
      this.ruleForm.companyId = this.companyInfo.id;
      this.ruleForm.companyCode = this.companyInfo.companyCode;
      this.ruleForm.address = this.companyInfo.address;
      this.ruleForm.purOrdNo = this.getClickValue[0].purOrdNo;
      this.ruleForm.purOrdDate = this.getClickValue[0].purOrdDate;
      //设置单据日期    
      serverTime.getServiceTime().then(serverTime => {
        that.$set(
          that.ruleForm,
          "planDate",
          serverTime.Format("yyyy-MM-dd")
        );
      });
      //获取计划单号
      this.getDeliveryPlanNo().then((planNo) => {
        //创建送货单时处理明细行
        this.rowData = this.getClickValue;
        this.sameUnit(this.rowData)
        this.rowData.forEach(row => {
          row.deliveryNo = planNo
        })
        this.$refs.agGirdComponent.gridOptions.api.setRowData(this.rowData);
        this.$refs.agGirdComponent.gridOptions.api.forEachNode(function (node) {
          //新增时id 默认为0
          // node.data.id = 0;
          //计划数量默认设置为可计划数量
          if (node.data.planableAmount > 0) {
            node.data.planAmount = node.data.planableAmount;
          } else {
            node.data.planAmount = 0
          }
          let rowIndex = that.$refs.agGirdComponent.gridOptions.api.getRowNode(node.rowIndex);
          //设置行号
          rowIndex.setDataValue("deliveryIMxNo", node.rowIndex + 1);
          //设置底部合计计划数量
          if (node.data.planAmount != null) {
            that.totalPlanAmount = addOperation.accAdd(
              node.data.planAmount,
              that.totalPlanAmount
            );
            that.$refs.agGirdComponent.gridOptions.api.setPinnedBottomRowData(
              that.createBottomRow(1, "Bottom")
            );
          }
        });
        this.$refs.agGirdComponent.rowDataChange = false;
      });
    }
    else if (this.pageLayOut == "edit") {
      this.inputDis = true;
      this.inputDis2 = false
      this.ruleForm = this.getClickValue;
      if (
        this.getClickValue.billState === 1
      )
        this.btnShow = true;
      else this.btnShow = false;
      if (this.getClickValue.billState === 2) {
        this.remarkDis = true;
        this.offset = 22;
        // 隐藏操作列
        this.$refs.agGirdComponent.gridOptions.columnApi.setColumnVisible(
          "operator",
          false
        );
      } else this.remarkDis = false;
      this.getDelPlanDetail(this.getClickValue.id);
    } else if (this.pageLayOut == "view") {
      // 隐藏操作列
      this.$refs.agGirdComponent.gridOptions.columnApi.setColumnVisible(
        "operator",
        false
      );
      this.inputDis = true;
      this.inputDis2 = true
      this.remarkDis = true
      this.btnShow = false
      this.ruleForm = this.getClickValue;
      this.offset = 22
      this.getDelPlanDetail(this.getClickValue.id);
    }
  },
  components: {
    agGridComponents
  },
  props: ["getClickValue", "pageLayOut", "supplierInfo", "companyInfo"]
};
</script>

<style type="text/css">
/*.redItem .el-form-item__label{
        color: red;
    }*/
</style>